# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=foma
pkgver=0.10.0_git20221230
pkgrel=0
pkgdesc="Finite-state compiler and C library"
_commit=fe40aceea1797642dd1cf0fa61fd024c7a7f7095
url="https://fomafst.github.io/"
arch="all"
license="Apache-2.0"
options="!check" # no tests
makedepends="cmake bison flex ninja readline-dev zlib-dev"
subpackages="libfoma:libs $pkgname-dev"
source="$pkgname-$_commit.tar.gz::https://github.com/mhulden/foma/archive/$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit/foma"

build() {
	# does not build with c2x, remove it
	sed -i -e 's/"-std=c2x" //g' CMakeLists.txt

	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=MinSizeRel
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	find "$pkgdir" -name "*.a" -delete
}

sha512sums="
c96c49f24fe88fc6fad382965ccc27d912cb9ec95561abc29e7c7b9398098d88f98b343ea10c2d4b817d84b388edb3441395c7cde85ff18bfb0ed108d7c9d6ac  foma-fe40aceea1797642dd1cf0fa61fd024c7a7f7095.tar.gz
"
